<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><{$Think.config.cfg_webname}></title>

    <link href="__CSS__/base.css" rel="stylesheet">
    <link href="__CSS__/school.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/custom/uimaker/easyui.css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/custom/uimaker/icon.css">
    <script type="text/javascript" src="__PUBLIC__/custom/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/custom/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/custom/easyui-lang-zh_CN.js"></script>
</head>
<body>
<table title="栏目管理" id = "dg" class="easyui-treegrid" style="width:100%"
       data-options="
				url: '<{:U(\'Info/getInfoClass\')}>',
				method: 'get',
				idField: 'id',
				treeField: 'classname',
				toolbar:'#tb'
			">
    <thead>
    <tr>
        <th data-options="field:'ck',checkbox:true"  width="10%"></th>
        <th data-options="field:'id'" width="20%" align="center">ID</th>
        <th data-options="field:'classname'" width="29%" align="center">栏目名称</th>
        <th data-options="field:'orderid'" width="20%" align="center">排序</th>
        <th data-options="field:'operate'" width="30%" align="center" formatter = "edit">操作</th>
    </tr>
    </thead>
</table>
<div id="tb" style="padding:0 30px;">
    <form id="searchForm">
        <div class="conditions">
            <span class="con-span">栏目名称: </span><input class="easyui-textbox" type="text" id="classname"
                                                       name="classname"
                                                       style="width:166px;height:35px;line-height:35px;">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="dosearch()" iconCls="icon-search"
               data-options="selected:false">查询</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doreset()" iconCls="icon-reload">重置</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doadd()" iconCls="icon-reload">新增</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doedit()" iconCls="icon-edit">修改</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="doremove()" iconCls="icon-remove">删除</a>
        </div>
    </form>
</div>
<script>

    var iconCls = 'icon-list';
    var iframe = true;

    function edit(value, row, index){
        var title = row.classname+"[栏目]";
        var url = '<{:U("Info/addInfoClass")}>/id/' + row.id;
        return '<a href="javascript:void(0);" onclick="window.parent.addTab(\'' + title + '\',\'' + url + '\',\'' + iconCls + '\',\'' + iframe + '\')">查看</a>';
    }

    function dosearch(){
        $('#dg').datagrid('load',{
            classname: $("#classname").val(),
        });
    }

    function doreset(){
        $("#searchForm").form('reset');
        $('#dg').datagrid('load',{
//            topic: '',
        });
    }

    function doadd(){
        var title = "新增栏目管理";
        var url = '<{:U("Info/addInfoClass")}>';
        window.parent.addTab(title,url,iconCls,iframe);
    }

    function doedit(){
        var arr=$('#dg').datagrid('getSelections');
        if(arr.length!=1){
            $.messager.show({
                title:'提示信息',
                msg:'请选择一条记录修改!'
            });
        }else{
            var title = "修改栏目";
            var url = '<{:U("Info/addInfoClass")}>/id/' + arr[0]['id'];
            window.parent.addTab(title,url,iconCls,iframe);
        }
    }

</script>
</body>
</html>
